public class Student {
    private String sex;
    private int age;

    public  String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        if (sex == "男"||sex == "女") {
            this.sex = sex;
        }
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age<=18&&age>=6) {
            this.sex = sex;
        }
    }

    public static void main(String[] args) {
        Student s=new Student();
        String x="女";
        s.setSex(x);
        System.out.println(s.getSex());
    }
}
